package cn.iocoder.yudao.module.indicator.service.element;

import cn.iocoder.yudao.module.indicator.dao.element.ElementDoctorDayDao;
import cn.iocoder.yudao.module.indicator.domain.dto.IndexCalculationDto;
import cn.iocoder.yudao.module.indicator.domain.vo.ElementCalculationVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description 元素医生表查询（诊疗组查询）
 * @Author ZWC
 * @Date 2024/9/26 16:02
 */
@Service
public class ElementDoctorServiceImpl implements ElementCalculationService {

    @Resource
    ElementDoctorDayDao elementDoctorDayDao;
    private Boolean checkDateType(IndexCalculationDto indexCalculationDto){
        String DATE_TYPE = "日,月,年";
        return DATE_TYPE.contains(indexCalculationDto.getDateType());
    }

    /**
     * 功能描述: 获取元素值
     * @Param:
     * @Return:
     * @Author: ZWC
     * @Date: 2024/9/26
     */
    public List<ElementCalculationVo> getElementById(IndexCalculationDto indexCalculationDto){
        if(checkDateType(indexCalculationDto)){
            //调用的是医生表的数据
            List<ElementCalculationVo> elementByDate = elementDoctorDayDao.getElementByDate(indexCalculationDto);
            return elementByDate;
        }
        return new ArrayList<ElementCalculationVo>();
    }

    /**
     * 功能描述: 获取医生表的机构元素值明细
     * @Param:
     * @Return:
     * @Author: ZWC
     * @Date: 2024/9/26
     */
    public List<ElementCalculationVo> getElementGroupInstitute(IndexCalculationDto indexCalculationDto){
        if(checkDateType(indexCalculationDto)){
            return elementDoctorDayDao.getElementGroupInstitute(indexCalculationDto);
        }
        return new ArrayList<ElementCalculationVo>();
    }

    /**
     * 功能描述: 获取医生元素值明细
     * @Param:
     * @Return:
     * @Author: ZWC
     * @Date: 2024/9/26
     */
    public List<ElementCalculationVo> getElementGroupDoctor(IndexCalculationDto indexCalculationDto){
        if(checkDateType(indexCalculationDto)){
            return elementDoctorDayDao.getElementGroupDoctor(indexCalculationDto);
        }
        return new ArrayList<ElementCalculationVo>();
    }

    /**
     * 功能描述: 获取元素 趋势
     * @Param:
     * @Return:
     * @Author: ZWC
     * @Date: 2024/9/26
     */
    public List<ElementCalculationVo> getElementTrend(IndexCalculationDto indexCalculationDto){
        if(checkDateType(indexCalculationDto)){
            return elementDoctorDayDao.getElementHistoricalData(indexCalculationDto);
        }
        return new ArrayList<ElementCalculationVo>();
    }
}
